package com.example.backend.controller;


import com.example.backend.model.UserAuth;
import com.example.backend.service.UserAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    private UserAuthService userAuthService;

    @PostMapping("/login")
    public String login(@RequestBody UserAuth userAuth) {
        if (userAuthService.authenticate(userAuth)) {
            return "登录成功";
        } else {
            return "用户名或密码错误";
        }
    }
}